package 笔试真题;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Tengxun5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Integer[] values = new Integer[n];
        ArrayList<Integer> integers = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            values[i] = scanner.nextInt();
            integers.add(values[i]);
        }
        Integer max = Collections.max(integers);
        int i = Arrays.binarySearch(values, max);
        int j;
        for (j = i; j < n; j++) {
            if(values[j]!=max){
                break;
            }
        }
        System.out.println(4);
        if(i==0 && j ==n );
        int min = Math.min(values[i-1],values[j]);

    }
}
